<template>
    <div class="mask-box">
      <div class="mask-body"></div>
      <transition name="scale">
        <div class="btn-box" v-if="isshow">
          <div class="message">
            <p>{{message}}</p>
          </div>
          <div class="btn-left" @click="chooseTrue()">
            <p>确定</p>
          </div>
          <div class="btn-right" @click="chooseFalse()">
            <p>取消</p>
          </div>
        </div>
    </transition>
    </div>
</template>

<script>
export default {
  name: "MaskBox",
  props: {
    message: {
      type: String,
      default: ""
    }
  },
  data(){
    return{
      isshow:false,
    }
  },
  methods: {
    chooseTrue() {
      this.$emit("chooseing", true);
    },
    chooseFalse() {
      this.$emit("chooseing", false);
    }
  },
  show() {
    this.isshow = true;
  },
  hide() {
    this.isshow = false;
  },
  mounted() {
    this.isshow = true;
    console.log(this.isshow)
  }
};
</script><style lang="stylus" scoped>
.mask-box {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
.scale-enter-active,.scale-leave-active{
  transition:all .15s linear ;
}
.scale-enter,.scale-leave-to{
  transform:scale(0.6);
}
  .mask-body {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background: #000000;
    opacity: 0.2;
    z-index: 200;
  }

  .btn-box {
    width: 250px;
    height: 125px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: auto;
    background: #ffffff;
    z-index: 300;
    border-radius: 8px;

    .message {
      width: 100%;
      height: 78px;
      border-radius: 8px 8px 0 0;
      line-height: 22px;
      text-align: center;
      border-bottom: 2px solid #666;
      float: left;
      display: flex;
      flex-direction: column;
      justify-content: space-around;
      align-items: center;

      p {
        font-size: 20px;
        font-weight: 800;
      }
    }

    .btn-left {
      width: 50%;
      box-sizing: border-box;
      height: 45px;
      border-radius: 0 0 0 8px;
      border-right: 1px solid #666;
      text-align: center;
      line-height: 45px;
      float: left;

      p {
        font-size: 16px;
        font-weight: 900;
      }
    }

    .btn-right {
      width: 50%;
      height: 45px;
      border-radius: 0 0 8px 0;
      box-sizing: border-box;
      border-left: 1px solid #666;
      text-align: center;
      line-height: 45px;
      float: left;

      p {
        font-size: 16px;
        font-weight: 900;
      }
    }
  }
}
</style>
